Skip to content

Post-process flatc jsonschema output into rich schema - #474

Open
Thomas-Mikhael wants to merge 1 commit into
eclipse-score:mainfrom
etas-contrib:flatbuffers_to_rich_json_schema_converter
Open

Post-process flatc jsonschema output into rich schema#474
Thomas-Mikhael wants to merge 1 commit into
eclipse-score:mainfrom
etas-contrib:flatbuffers_to_rich_json_schema_converter

Conversation

@Thomas-Mikhael

Copy link
Copy Markdown

schema_generator.py can rebuild the json schema shared defs (based on fbs comment tokens)

schema_generator.py can rebuild the json schema shared defs (based on fbs comment tokens)
@github-actions

Copy link
Copy Markdown
Contributor

Documentation preview for this pull request is available at:
pr-474: https://eclipse-score.github.io/baselibs/pr-474/

@4og
4og requested a balanced review from Copilot August 18, 2026 07:20

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds post-processing to generate richer draft-2020-12 JSON schemas from FlatBuffers definitions.

Changes:

  • Adds metadata extraction, reference inlining, and shared $defs.
  • Integrates the generator into the Bazel rule.
  • Registers the generator as an executable Bazel target.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
score/flatbuffers/bazel/tools.bzl Runs schema post-processing after flatc.
score/flatbuffers/bazel/schema_generator.py Implements schema enrichment.
score/flatbuffers/bazel/BUILD Defines the generator executable.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +174 to +180
properties = {}
required = []
for field_name, field_node in def_node.get("properties", {}).items():
built, is_required = self.build_field(field_node)
properties[field_name] = built
if is_required:
required.append(field_name)
Comment on lines +142 to +144
# Scalar / string / bool leaf.
meta, desc = _parse_description(node.get("description", ""))
out = {"type": node_type}
Comment on lines +127 to +129
# Non-shared table reference -> inline it. Such fields are authored bare
# (metadata lives on the referenced table), so they are never required here.
return self.build_object(self._defs[ref]), False
Comment on lines +139 to +140
out["items"] = self._build_items(node["items"])
return out, meta["required"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bazel Bazel and Starlark build files comp-flatbuffers Related to score/flatbuffers component

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

2 participants